<html>
<head><meta charset="utf-8"><title>removing static from place · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html">removing static from place</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178521321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178521321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178521321">(Oct 19 2019 at 00:47)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="120791">@RalfJ</span> --</p>
<p>So <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> and I were talking about the "Place 2.0" work. Now that the interning of projections is basically done, we were talking about what further simplifications we could do. One thought that <span class="user-mention" data-user-id="119009">@eddyb</span> mentioned, and which I think probably makes sense, is to remove "statics" from <code>PlaceBase</code>, so that all places begin with a local variable. This not only simplifies the definition of a "place", it also means we can reduce them to be (a) Copy and (b) 128 bits. <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> </p>
<p>We wrote up a hackmd document containing a <a href="https://hackmd.io/qH-ptngCSdyDInPq5kwFmA?view" target="_blank" title="https://hackmd.io/qH-ptngCSdyDInPq5kwFmA?view">proposal for how to go about this</a> -- please take a look and see what you think! It includes some rough details of how this would interact with the borrow checker, unsafe code, etc, as well as some possible implementation steps.</p>



<a name="178538605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538605">(Oct 19 2019 at 09:53)</a>:</h4>
<p>Ah, that's very interesting. I am not sure what exactly the interactions with Stacked Borrows will be but I don't feel the document gives them justice. :D but off the top of my head I think this is a good change, yes. This actually fixes some UB I was worried about with statics and Stacked Borrows :D</p>



<a name="178538610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538610">(Oct 19 2019 at 09:53)</a>:</h4>
<p>so in the light of the <code>static mut</code> discussion, is it correct that <code>RefStatic</code> would never be used for a mutable static?</p>



<a name="178538651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538651">(Oct 19 2019 at 09:54)</a>:</h4>
<p>that makes me wonder if it wouldn't be easier to also not have it for normal <code>static</code></p>



<a name="178538655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538655">(Oct 19 2019 at 09:54)</a>:</h4>
<p>I dislike the duplication of <code>RefStatic</code> and <code>RawStatic</code>. Maybe we could have a <code>PlaceOrStatic</code> type that we use for these specific operations?</p>



<a name="178538659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538659">(Oct 19 2019 at 09:54)</a>:</h4>
<p>we could just have only <code>RawStatic</code></p>



<a name="178538668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538668">(Oct 19 2019 at 09:55)</a>:</h4>
<p>and desugar <code>&amp;mut S</code> to <code>&amp;mut *RawStatic(S)</code></p>



<a name="178538920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178538920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178538920">(Oct 19 2019 at 10:03)</a>:</h4>
<p>here are some incoherent Stacked Borrows thoughts (could someone add that to the document? I dont seem to have edit permissions):<br>
This moves us towards a model where the static itself does <em>not</em> have a "tag" at all as it isn't a place. There's no "unique root identity" at the bottom of the borrow stack of a static. That's in strong contrast to locals where there's a unique tag at the bottom. This unique tag is what makes <code>local = 5</code> kill all other pointers to that local. I thought the same should happen for statics and actually already did some implementation work along those lines in Miri (making sure we pick a consistent tag for the <code>static</code> place), but this proposal indicates to me that we maybe don't want a base identity for statics, and that <code>STATIC = 5</code> should <em>not</em> kill all other pointers (including raw pointers)!</p>
<p>So, this is illegal:</p>
<div class="codehilite"><pre><span></span>let mut x: u32 = 0;
let ptr = &amp;raw mut x;
x = 2;
let _val = *ptr; // UB
</pre></div>


<p>But this is allowed:</p>
<div class="codehilite"><pre><span></span>static mut X: u32 = 0;
let ptr = &amp;raw mut x;
X = 2;
let _val = *ptr; // all is good
</pre></div>


<p>I'd be happy to remove the code I wrote to make statics more like locals, it's somewhat annoyingly complicated (and other people ran into that code like a brick wall when trying to implement shims for an extern static in Miri).</p>
<p>So, summary: The change seems fine to me. It <em>does</em> have some effects on Stacked Borrows, maybe more than you expected, but I think these are good effects. Basically it we could take this to mean that there is an inconsistency between <code>static</code> and locals <em>both</em> in Stacked Borrows and the rustc internal data structure, and it's nice to at least be consistent in these inconsistencies :D</p>



<a name="178541308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541308">(Oct 19 2019 at 11:12)</a>:</h4>
<p>so you'd want to treat statics more like leaked global allocations?</p>



<a name="178541336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541336">(Oct 19 2019 at 11:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="120791">@RalfJ</span> I think we can do this without any MIR btw :)</p>



<a name="178541388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541388">(Oct 19 2019 at 11:14)</a>:</h4>
<p>AFAIK we can already represent a reference/raw pointer to a static in a <code>ty::Const</code> (I hope <span class="user-mention" data-user-id="124288">@oli</span> or <span class="user-mention" data-user-id="120791">@RalfJ</span> confirm this)</p>



<a name="178541391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541391">(Oct 19 2019 at 11:14)</a>:</h4>
<p>omgz</p>



<a name="178541397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541397">(Oct 19 2019 at 11:14)</a>:</h4>
<p>yes we can</p>



<a name="178541401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541401">(Oct 19 2019 at 11:14)</a>:</h4>
<p>I forget when I first considered this and I'm sorry I didn't write it down before</p>



<a name="178541409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541409">(Oct 19 2019 at 11:15)</a>:</h4>
<p>this is similar to not having an <code>Rvalue</code> for literals</p>



<a name="178541476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541476">(Oct 19 2019 at 11:16)</a>:</h4>
<p>hmm... how does that fare with generic statics though</p>



<a name="178541478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541478">(Oct 19 2019 at 11:16)</a>:</h4>
<p>in terms of stacked borrows, I believe this has the same effect as using <code>RawStatic</code> (except without needing a MIR reborrow if you want a reference)</p>



<a name="178541484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541484">(Oct 19 2019 at 11:16)</a>:</h4>
<p>generic statics are impossible</p>



<a name="178541486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541486">(Oct 19 2019 at 11:16)</a>:</h4>
<p>promoteds then</p>



<a name="178541488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541488">(Oct 19 2019 at 11:16)</a>:</h4>
<p>same thing</p>



<a name="178541497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541497">(Oct 19 2019 at 11:17)</a>:</h4>
<p>ooooh I forgot we made those use the same infrastructure ugh</p>



<a name="178541500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541500">(Oct 19 2019 at 11:17)</a>:</h4>
<p>ah</p>



<a name="178541504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541504">(Oct 19 2019 at 11:17)</a>:</h4>
<p>no we can fix that</p>



<a name="178541506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541506">(Oct 19 2019 at 11:17)</a>:</h4>
<p>we just refer to them by value</p>



<a name="178541512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541512">(Oct 19 2019 at 11:17)</a>:</h4>
<p>like the constant represents the promoted</p>



<a name="178541562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541562">(Oct 19 2019 at 11:18)</a>:</h4>
<p>how do references to <code>static</code>s work in <code>ty::Const</code> today?</p>



<a name="178541570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541570">(Oct 19 2019 at 11:18)</a>:</h4>
<p>is the <code>Instance</code>(-like) information in the <code>ty::Const</code> or behind some sort of ID?</p>



<a name="178541582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541582">(Oct 19 2019 at 11:19)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> so you'd want to revert promoteds back to not being places?</p>



<a name="178541584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541584">(Oct 19 2019 at 11:19)</a>:</h4>
<p>I think we should do that first hmpf</p>



<a name="178541642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541642">(Oct 19 2019 at 11:20)</a>:</h4>
<p>the only case where we rely on the place-like nature is the <code>&amp;promoted[runtime]</code> replacement which can be <code>&amp;(*promoted)[runtime]</code>, I think?</p>



<a name="178541674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541674">(Oct 19 2019 at 11:21)</a>:</h4>
<p>I guess we'd need to agree where we stick the <code>Promoted</code> back into</p>



<a name="178541721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178541721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178541721">(Oct 19 2019 at 11:22)</a>:</h4>
<p>unevaluated <code>ty::Const</code> perhaps?</p>



<a name="178543666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178543666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178543666">(Oct 19 2019 at 12:17)</a>:</h4>
<p>yes</p>



<a name="178549408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549408">(Oct 19 2019 at 14:48)</a>:</h4>
<blockquote>
<p>generic statics are impossible</p>
</blockquote>
<p>What does that mean? Once we kill dylibs we could have generic statics, no?</p>



<a name="178549418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549418">(Oct 19 2019 at 14:49)</a>:</h4>
<p>impossible right now</p>



<a name="178549420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549420">(Oct 19 2019 at 14:49)</a>:</h4>
<p>that might not remain the case</p>



<a name="178549479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549479">(Oct 19 2019 at 14:50)</a>:</h4>
<p>it will still be doable with this scheme</p>



<a name="178549485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549485">(Oct 19 2019 at 14:50)</a>:</h4>
<p>actually it will be trivial</p>



<a name="178549490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549490">(Oct 19 2019 at 14:51)</a>:</h4>
<p>much better than how it could be done right now</p>



<a name="178549553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178549553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178549553">(Oct 19 2019 at 14:52)</a>:</h4>
<p>cool</p>



<a name="178595365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178595365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178595365">(Oct 20 2019 at 14:25)</a>:</h4>
<p>I'm not sure you need to kill dylibs as much as you want some strong semantics from linkers</p>



<a name="178595367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178595367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178595367">(Oct 20 2019 at 14:25)</a>:</h4>
<p>to deduplicate based on... symbol name? at least I think that's correct</p>



<a name="178595424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178595424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178595424">(Oct 20 2019 at 14:27)</a>:</h4>
<p>at least with v0 mangling we were forced to encode the typesystem into symbol names</p>



<a name="178595428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178595428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178595428">(Oct 20 2019 at 14:27)</a>:</h4>
<p>I've always felt like generic/associated statics are impossible, given that nobody could give me an implementation strategy but I may have overlooked preexisting features</p>



<a name="178595470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178595470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178595470">(Oct 20 2019 at 14:28)</a>:</h4>
<p>there's ODR stuff for... C++ I think? I wonder if that works</p>



<a name="178852834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178852834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178852834">(Oct 23 2019 at 13:25)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span>, I was talking to both of you in private about this</p>



<a name="178852856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178852856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178852856">(Oct 23 2019 at 13:25)</a>:</h4>
<p>I have a couple of really minor next things to do related to mir 2.0</p>



<a name="178852908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178852908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178852908">(Oct 23 2019 at 13:25)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> told me that they are working on this specifically because there is some mess around</p>



<a name="178852968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178852968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178852968">(Oct 23 2019 at 13:26)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> can you elaborate that a bit more for <span class="user-mention" data-user-id="116009">@nikomatsakis</span> ?</p>



<a name="178852989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178852989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178852989">(Oct 23 2019 at 13:26)</a>:</h4>
<p>and then, question for you both, do you guys see something else that I can go after?</p>



<a name="178853088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178853088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178853088">(Oct 23 2019 at 13:27)</a>:</h4>
<blockquote>
<p>generic statics are impossible</p>
</blockquote>
<p>this is just an arbitrary limitation, I don't think we should bank on it</p>



<a name="178853161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178853161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178853161">(Oct 23 2019 at 13:28)</a>:</h4>
<p>(ah, ok, catching up)</p>



<a name="178853220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178853220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178853220">(Oct 23 2019 at 13:29)</a>:</h4>
<blockquote>
<p>I've always felt like generic/associated statics are impossible, given that nobody could give me an implementation strategy but I may have overlooked preexisting features</p>
</blockquote>
<p>(ok, I agree, not <em>entirely</em> arbitrary)</p>



<a name="178853426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178853426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178853426">(Oct 23 2019 at 13:31)</a>:</h4>
<blockquote>
<p>I dislike the duplication of <code>RefStatic</code> and <code>RawStatic</code>. Maybe we could have a <code>PlaceOrStatic</code> type that we use for these specific operations?</p>
</blockquote>
<p>so I guess I don't fully understand the plan you have in mind -- it sounds like you are planning to embed the <code>&amp;Foo</code> or <code>*mut Foo</code> that references a static into a constant?</p>
<p>That said, let me explain why I added both <code>RefStatic</code> and <code>RawStatic</code> -- I agree you would only need the raw pointer version, but I was trying to avoid having <code>&amp;X.foo</code> insert a "unsafe" (but blessed) operation. Here by unsafe I mean: something that the unsafe checker would flag. But I argee there's no fundamental reason to do that.</p>



<a name="178854540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178854540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178854540">(Oct 23 2019 at 13:43)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I'll add that to the doc -- I agree that we probably don't want a unique tag for statics. To me at least they feel "different"in that they are globally accessible.</p>



<a name="178854953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178854953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178854953">(Oct 23 2019 at 13:48)</a>:</h4>
<p>In any case, it seems to me <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> that regardless of what happens with <code>RawStatic</code>, <code>RefStatic</code>, etc, the first implementation step that I described in the document remains relevant:</p>
<ul>
<li>First don't change the definition of place at all. Instead, just change place <em>lowering</em> so that for an expression like <code>x = &amp;S.foo</code> we produce the MIR:<br>
    * <code>TMP = &amp;S</code> where <code>TMP: &amp;T</code><br>
    * <code>x = &amp;(*TMP).goo</code></li>
</ul>



<a name="178855003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178855003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178855003">(Oct 23 2019 at 13:48)</a>:</h4>
<p>ok, can try to do that</p>



<a name="178855155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178855155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178855155">(Oct 23 2019 at 13:50)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> can you perhaps update <a href="https://hackmd.io/qH-ptngCSdyDInPq5kwFmA?edit" target="_blank" title="https://hackmd.io/qH-ptngCSdyDInPq5kwFmA?edit">the proposal hackmd</a> -- I've saved the RefStatic/RawStatic version as a named revision in hackmd, so feel free to edit away</p>



<a name="178862096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178862096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178862096">(Oct 23 2019 at 14:59)</a>:</h4>
<p>I have a branch that passes all compile-pass and run-pass tests since 5 hours ago</p>



<a name="178862210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178862210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178862210">(Oct 23 2019 at 15:00)</a>:</h4>
<p>I did not add <code>RawStatic</code> or <code>RefStatic</code>, but instead did the lowering of treating any use of <code>STATIC</code> like <code>*&amp;STATIC</code> where the <code>&amp;STATIC</code> is a constant</p>



<a name="178866446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178866446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178866446">(Oct 23 2019 at 15:40)</a>:</h4>
<p>Here's the branch: <a href="https://github.com/oli-obk/rust/pull/new/static_unification_theory_teil_eins" target="_blank" title="https://github.com/oli-obk/rust/pull/new/static_unification_theory_teil_eins">https://github.com/oli-obk/rust/pull/new/static_unification_theory_teil_eins</a></p>



<a name="178866582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178866582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178866582">(Oct 23 2019 at 15:41)</a>:</h4>
<p>To reintroduce all the checks around statics we've had before, I'll need to check all constants instead of the static places</p>



<a name="178964417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964417">(Oct 24 2019 at 15:35)</a>:</h4>
<p>Skimming the branch now but I feel like I'm somehow missing something</p>



<a name="178964451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964451">(Oct 24 2019 at 15:35)</a>:</h4>
<p>I guess the idea is that we when you have <code>&amp;S</code> in the source code, you get <code>X = Constant(&amp;S)</code> now?</p>



<a name="178964543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964543">(Oct 24 2019 at 15:36)</a>:</h4>
<p>and presumably something like <code>let x = &amp;S.foo</code> becomes </p>
<div class="codehilite"><pre><span></span>TMP = Constant(&amp;S)
X = &amp;(*TMP).foo
</pre></div>


<p>where <code>TMP: &amp;typeof(S)</code></p>



<a name="178964564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964564">(Oct 24 2019 at 15:36)</a>:</h4>
<p>something like that, <span class="user-mention" data-user-id="124288">@oli</span>?</p>



<a name="178964602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964602">(Oct 24 2019 at 15:37)</a>:</h4>
<p>(This does raise the question of <code>#[thread_local]</code> statics and the current errors that we give there, I see you removed that logic)</p>



<a name="178964643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964643">(Oct 24 2019 at 15:37)</a>:</h4>
<p>(But honestly that logic is a bit weird anyway)</p>



<a name="178964686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964686">(Oct 24 2019 at 15:37)</a>:</h4>
<p>yea that's how it's implemented right now, and the logic is only removed in the <code>WIP</code> commit</p>



<a name="178964737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964737">(Oct 24 2019 at 15:38)</a>:</h4>
<p>Currently in your branch I see that there is still <code>Promoted</code> as part of a place</p>



<a name="178964748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964748">(Oct 24 2019 at 15:38)</a>:</h4>
<p>that commit should probably be called <code>TODO</code></p>



<a name="178964753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964753">(Oct 24 2019 at 15:38)</a>:</h4>
<p>is the plan to remove that?</p>



<a name="178964769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964769">(Oct 24 2019 at 15:38)</a>:</h4>
<p>yes, promoteds will get reverted back to constants, too</p>



<a name="178964781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964781">(Oct 24 2019 at 15:38)</a>:</h4>
<blockquote>
<p>yea that's how it's implemented right now, and the logic is only removed in the <code>WIP</code> commit</p>
</blockquote>
<p>I don't know where it will be added back in</p>



<a name="178964816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964816">(Oct 24 2019 at 15:38)</a>:</h4>
<p>under this approach, from the borrow checker's point of view, it seems like borrows of statics are "invisible"</p>



<a name="178964851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964851">(Oct 24 2019 at 15:39)</a>:</h4>
<p>they're part of a constant, they just always existed</p>



<a name="178964886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964886">(Oct 24 2019 at 15:39)</a>:</h4>
<p>oh cool that you jumped in Niko, I'm gonna take over <span class="user-mention" data-user-id="124288">@oli</span>'s branch and continue</p>



<a name="178964888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964888">(Oct 24 2019 at 15:39)</a>:</h4>
<p>(that seems... ok to me, but it doesn't leave room for that particular thread-local logic)</p>



<a name="178964894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964894">(Oct 24 2019 at 15:39)</a>:</h4>
<p>so being all in the same page, seems good :)</p>



<a name="178964895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178964895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178964895">(Oct 24 2019 at 15:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/commit/4e51411f71c0c8a2c04ee9031bd3da28bc6e515b" target="_blank" title="https://github.com/rust-lang/rust/commit/4e51411f71c0c8a2c04ee9031bd3da28bc6e515b">https://github.com/rust-lang/rust/commit/4e51411f71c0c8a2c04ee9031bd3da28bc6e515b</a> is how I did it for const qualif</p>



<a name="178965021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965021">(Oct 24 2019 at 15:40)</a>:</h4>
<p>I think this can be repeated in most places where I removed the static-place logic</p>



<a name="178965043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965043">(Oct 24 2019 at 15:40)</a>:</h4>
<p>I was afraid you were going to show me something like this :)</p>



<a name="178965046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965046">(Oct 24 2019 at 15:40)</a>:</h4>
<p>hehehe</p>



<a name="178965057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965057">(Oct 24 2019 at 15:40)</a>:</h4>
<p>it's mainly diagnostics</p>



<a name="178965064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965064">(Oct 24 2019 at 15:40)</a>:</h4>
<p>I think everything works</p>



<a name="178965066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965066">(Oct 24 2019 at 15:40)</a>:</h4>
<p>I think what your'e doing is sort of special-casing the case of "a constant that is <code>&amp;S</code> for a static"</p>



<a name="178965075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965075">(Oct 24 2019 at 15:40)</a>:</h4>
<p>except that some diagnostics have regressed badly</p>



<a name="178965076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965076">(Oct 24 2019 at 15:40)</a>:</h4>
<blockquote>
<p>it's mainly diagnostics</p>
</blockquote>
<p>it's not</p>



<a name="178965085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965085">(Oct 24 2019 at 15:40)</a>:</h4>
<p>I mean, not for this borrow-checker case?</p>



<a name="178965090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965090">(Oct 24 2019 at 15:40)</a>:</h4>
<p>Like, it determines <em>if</em> we give an error or not</p>



<a name="178965120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965120">(Oct 24 2019 at 15:41)</a>:</h4>
<p>right, for the thread local check it won't work by default I guess</p>



<a name="178965125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965125">(Oct 24 2019 at 15:41)</a>:</h4>
<p>because you just have a reference</p>



<a name="178965132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965132">(Oct 24 2019 at 15:41)</a>:</h4>
<p>that said, I do like this approach :)</p>



<a name="178965166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965166">(Oct 24 2019 at 15:41)</a>:</h4>
<p>I guess we could do some hacky thing around the thread-local check, or just .. not do it</p>



<a name="178965217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965217">(Oct 24 2019 at 15:42)</a>:</h4>
<p>loads of errors are now "can't do X with immutable reference" instead of "can't do X with immutable static"</p>



<a name="178965231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965231">(Oct 24 2019 at 15:42)</a>:</h4>
<p>yeah, no doubt</p>



<a name="178965266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965266">(Oct 24 2019 at 15:42)</a>:</h4>
<p>pardon my ignorance but what's the thread-local check you're talking about?</p>



<a name="178965273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965273">(Oct 24 2019 at 15:42)</a>:</h4>
<p>for that kind of thing I think maybe the approach you're using is ok, or else we should maybe just find a "middle wording"</p>



<a name="178965275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965275">(Oct 24 2019 at 15:42)</a>:</h4>
<p>that's why I did the const qualif change, to improve diagnostics again</p>



<a name="178965280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965280">(Oct 24 2019 at 15:42)</a>:</h4>
<p>I don't love our wording anyway tbh</p>



<a name="178965284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965284">(Oct 24 2019 at 15:42)</a>:</h4>
<p>I've always though we give far too many details</p>



<a name="178965302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965302">(Oct 24 2019 at 15:42)</a>:</h4>
<p>that are often only semi-relevant</p>



<a name="178965312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965312">(Oct 24 2019 at 15:43)</a>:</h4>
<p>besides the term "immutable reference" is in my view just wrong :P</p>



<a name="178965336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965336">(Oct 24 2019 at 15:43)</a>:</h4>
<p>(but obviously this is a separate concern...)</p>



<a name="178965377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965377">(Oct 24 2019 at 15:43)</a>:</h4>
<p>yea, any ideas on how to unify this and use less specialized diagnostics are very welcome :D</p>



<a name="178965379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965379">(Oct 24 2019 at 15:43)</a>:</h4>
<blockquote>
<p>pardon my ignorance but what's the thread-local check you're talking about?</p>
</blockquote>
<p>this compiles </p>
<div class="codehilite"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="n">S</span>: <span class="kt">u32</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="n">S</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="178965399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965399">(Oct 24 2019 at 15:43)</a>:</h4>
<p>this does not</p>
<div class="codehilite"><pre><span></span><span class="cp">#[thread_local]</span><span class="w"></span>
<span class="k">static</span><span class="w"> </span><span class="n">S</span>: <span class="kt">u32</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="kt">u32</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="n">S</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="178965448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965448">(Oct 24 2019 at 15:44)</a>:</h4>
<p><code>#[thread_local]</code> is an unstable feature in any case</p>



<a name="178965465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965465">(Oct 24 2019 at 15:44)</a>:</h4>
<p>and not one with a clear path to stabilization, never RFC'd, etc</p>



<a name="178965470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965470">(Oct 24 2019 at 15:44)</a>:</h4>
<p>heh, I have an idea</p>



<a name="178965476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965476">(Oct 24 2019 at 15:44)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="178965479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965479">(Oct 24 2019 at 15:44)</a>:</h4>
<p>for thread locals</p>



<a name="178965512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965512">(Oct 24 2019 at 15:44)</a>:</h4>
<p>the reason the second one does not compile is because maybe <code>foo</code> is the "main" of a thread, I think</p>



<a name="178965524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965524">(Oct 24 2019 at 15:44)</a>:</h4>
<p>the code that creates the constant (in the first commit), could detect that it's a thread local and use a function local lifetime for the reference</p>



<a name="178965568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965568">(Oct 24 2019 at 15:45)</a>:</h4>
<p>that seems weird too -- a constant with a lifetime that is local to the fn?</p>



<a name="178965571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965571">(Oct 24 2019 at 15:45)</a>:</h4>
<p>also, that's not even meaningful</p>



<a name="178965595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965595">(Oct 24 2019 at 15:45)</a>:</h4>
<p>i.e., we literally erase all the lifetimes at the start of NLL</p>



<a name="178965599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965599">(Oct 24 2019 at 15:45)</a>:</h4>
<p>/me does not know a thing about borrowck</p>



<a name="178965604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965604">(Oct 24 2019 at 15:45)</a>:</h4>
<p>and recompute them from scratch</p>



<a name="178965609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965609">(Oct 24 2019 at 15:45)</a>:</h4>
<p>oh <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span></p>



<a name="178965646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965646">(Oct 24 2019 at 15:45)</a>:</h4>
<p>in any case I agree we could hack <em>something</em> up, but it feels...like part of the elegance of this approach comes from <em>not</em> needing a special case :)</p>



<a name="178965755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965755">(Oct 24 2019 at 15:46)</a>:</h4>
<p>I think we should ignore that for now</p>



<a name="178965757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965757">(Oct 24 2019 at 15:46)</a>:</h4>
<p>and continue with your approach</p>



<a name="178965787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965787">(Oct 24 2019 at 15:46)</a>:</h4>
<p>once everything else seems good, we can worry about <code>#[thread_local]</code> and the best way to re-encode that</p>



<a name="178965803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965803">(Oct 24 2019 at 15:47)</a>:</h4>
<p>so you mean if we changed the wording in  const qualif to not refer to references or statics, we could remove all the special casing for statics and just report "cannot mutate immutable value" or sth</p>



<a name="178965827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965827">(Oct 24 2019 at 15:47)</a>:</h4>
<p>right</p>



<a name="178965828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965828">(Oct 24 2019 at 15:47)</a>:</h4>
<p>yea, for now I'd rather make the PR</p>



<a name="178965833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965833">(Oct 24 2019 at 15:47)</a>:</h4>
<p>not change behaviour</p>



<a name="178965851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965851">(Oct 24 2019 at 15:47)</a>:</h4>
<p>and then have follow-up PRs</p>



<a name="178965875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965875">(Oct 24 2019 at 15:47)</a>:</h4>
<p>(maybe once promoteds are also not places anymore)</p>



<a name="178965914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965914">(Oct 24 2019 at 15:48)</a>:</h4>
<p>yes, it's just kind of annoying if we have to add a bunch of logic and then we wind up removing it. but it seems better to not bring together  changing the error message <em>and</em> changing MIR</p>



<a name="178965968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965968">(Oct 24 2019 at 15:48)</a>:</h4>
<p>I don't honestly remember what const-qualif even does</p>



<a name="178965990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965990">(Oct 24 2019 at 15:48)</a>:</h4>
<p>I guess it gives errors for doing things in constants you should not do?</p>



<a name="178965996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178965996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178965996">(Oct 24 2019 at 15:48)</a>:</h4>
<p>ensure that we don't have <code>Cell</code> constants behind references</p>



<a name="178966005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966005">(Oct 24 2019 at 15:48)</a>:</h4>
<p>(I don't have a strong opinion about <em>its</em> error messages)</p>



<a name="178966009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966009">(Oct 24 2019 at 15:48)</a>:</h4>
<p>and fancy variants of that</p>



<a name="178966020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966020">(Oct 24 2019 at 15:48)</a>:</h4>
<p>yeah ok</p>



<a name="178966037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966037">(Oct 24 2019 at 15:48)</a>:</h4>
<p>that's sort of what I imagined</p>



<a name="178966078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966078">(Oct 24 2019 at 15:49)</a>:</h4>
<p>oh, const qualif does need the static check</p>



<a name="178966089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966089">(Oct 24 2019 at 15:49)</a>:</h4>
<p>because it also ensures that constants can't refer to statics</p>



<a name="178966416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966416">(Oct 24 2019 at 15:52)</a>:</h4>
<p>ps I think the changes to const qualif might be fine -- I'm not as familiar with the code there --</p>



<a name="178966430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966430">(Oct 24 2019 at 15:52)</a>:</h4>
<p>one thing I do wonder though</p>



<a name="178966469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966469">(Oct 24 2019 at 15:52)</a>:</h4>
<p>if the user writes</p>
<div class="codehilite"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="n">FOO</span>: <span class="kt">u32</span><span class="p">;</span><span class="w"></span>
<span class="k">const</span><span class="w"> </span><span class="n">BAR</span>: <span class="kp">&amp;</span><span class="kt">u32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">FOO</span><span class="p">;</span><span class="w"></span>
</pre></div>



<a name="178966511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966511">(Oct 24 2019 at 15:52)</a>:</h4>
<p>presumably const-qualif can see the difference between <code>BAR</code> and the new constants we are introducing?</p>



<a name="178966943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/removing%20static%20from%20place/near/178966943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/removing.20static.20from.20place.html#178966943">(Oct 24 2019 at 15:56)</a>:</h4>
<p>yes</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>